from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `admin_power` MODIFY COLUMN `url` VARCHAR(255) COMMENT '权限路径';
        ALTER TABLE `admin_power` MODIFY COLUMN `open_type` VARCHAR(10) COMMENT '打开方式';
        ALTER TABLE `admin_role` ADD `data_scope` INT NOT NULL COMMENT '数据权限范围' DEFAULT 0;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `admin_role` DROP COLUMN `data_scope`;
        ALTER TABLE `admin_power` MODIFY COLUMN `url` VARCHAR(255) NOT NULL COMMENT '权限路径';
        ALTER TABLE `admin_power` MODIFY COLUMN `open_type` VARCHAR(10) NOT NULL COMMENT '打开方式';"""
